package com.chenyongjing.design.pattern.decorator.general;

public class Client {
    public static void main(String[] args) {
        // 首先创建需要被装饰的原始对象（即要被装饰的对象）
        Component c1 = new ConcreteComponent();
        // 给对象透明的增加功能A并调用
        System.out.println("=========给对象透明的增加功能A并调用==========");
        Decorator decoratorA = new ConcreteDecocatorA(c1);
        decoratorA.operation();
        // 给对象透明的增加功能B并调用
        System.out.println("=========给对象透明的增加功能B并调用==========");
        Decorator decoratorB = new ConcreteDecoratorB(c1);
        decoratorB.operation();
        // 装饰器也可以装饰具体的装饰器
        System.out.println("=========装饰器也可以装饰具体的装饰器==========");
        Decorator decoratorBandA = new ConcreteDecoratorB(decoratorA);
        decoratorBandA.operation();

    }
}
